@extends('admin.layout.layout')
<!-- 网页标题 -->
@section('title')
   <title>友链列表页面</title>
@endsection
@section('content')
<div class="col-sm-12">
        <section class="panel">
       
<div class="col-lg-12">
    <h1 class="page-header">友链列表</h1>
</div>
<!-- /.col-lg-12 -->

        <div class="panel-body">
        <div class="adv-table">
        <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline" role="grid">

<form action="{{url('/admin/frilk/list')}}" method="get">
<div class="span12">
<div id="dynamic-table_length" class="dataTables_length">
<label>
<select class="form-control" size="1" name="pnum" aria-controls="dynamic-table">
<option value="2" @if(!empty($request['pnum'])  && $request['pnum'] == 10) selected @endif>2</option>


</select>每页显示的条数
</label>
<div style="float: right;"><label>友链关键词: <input name="keywords" type="text" class="form-control" aria-controls="dynamic-table" value="@if(!empty($request['keywords'])){{ $request['keywords'] }}@endif">
<button class="btn btn-default">查询</button>
</label>
</div>
</div>
</div>
</form>


        <table class="table table-bordered table-hover" width="100%">
        <tr>
            <th style="text-align:center">ID</th>
            <th style="text-align:center">友链关键词</th>
            <th style="text-align:center">友链网址</th>
            <th style="text-align:center">友链图片</th>
            <th style="text-align:center">友链描述</th>
            <th style="text-align:center">操作</th>
        </tr>
         @foreach($frilk as $k =>$v)
        <tr>
            <td style="text-align:center" class="sid">{{$v->id}}</td>
            <td style="text-align:center">{{$v->flkws}}</td>
            <td style="text-align:center">{{$v->flurl}}</td>
            <td style="text-align:center"><img src="{{$v->flpic}}"width="20px"height=20px""></td>
            <td style="text-align:center">{!!$v->editorValue!!}</td>
            <td style="text-align:center"><a href="{{url('/admin/frilk/edit',['id'=>$v->id])}}">修改</a>| <a href="{{url('/admin/frilk/delete',['id'=>$v->id])}}" class="delete">删除</a> </td>
        </tr>
       @endforeach
        </table>
       
        <div style="float: right;">
              {!!$frilk->appends($request)->render() !!}
        </div>
        </div>
        </div>
        </section>
        </div>
        @section('myjs')
        <script type="text/javascript">
        $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
});
       $('.delete').click(function(){
        var id = $(this).parents('tr').find('.sid').html();
        var dd = $(this);
        // alert(id);
        //发送ajax
        $.post('/admin/frilk/delete',{id:id},function(data){
            // console.log(data);
            if(data == 1){
                 alert ('删除成功');
                dd.parents('tr').remove();
            }else{
                alert('删除失败');
            }
        })
        return false;
       })
        </script>
        @stop
@stop
